﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _08_SignedBinaryRepresentation
{
    class Program
    {
        static string SignedBinaryConverter(short decNumber)
        {
            StringBuilder doubleWord = new StringBuilder(); // double word = 16bits.
            for (int i = 0; i < 16; i++)
            {
                doubleWord.Insert(0, ((decNumber >> i) & 1));
            }

            return doubleWord.ToString();
        }       
        static void Main(string[] args)
        {
            short signedNumber = -127;
            Console.WriteLine(SignedBinaryConverter(signedNumber));
        }
    }
}
